package cn.com.gome.sn.task.utils;

import cn.com.gome.frame.logger.HLogger;
import cn.com.gome.frame.logger.LoggerManager;

import java.util.Enumeration;
import java.util.HashMap;
import java.util.Locale;
import java.util.Map;
import java.util.ResourceBundle;

/**
 * 
* @ClassName: GerneralInitParams 
* @Description: 读取配置文件到map缓存中 
* @author lixiaobin 
* @date 2015年5月15日 下午3:25:32
 */
public class GerneralInitParams {

	public static final HLogger logger = LoggerManager.getLoger("GerneralInitParams");

	protected static Map<String,String> map = new HashMap<String,String>();

	static{
		try{
			ResourceBundle resb1 = ResourceBundle.getBundle("props.task",Locale.CHINESE);
			Enumeration<String> e = resb1.getKeys();
			while (e.hasMoreElements()) {
				String key = e.nextElement();
				logger.info("<key>:"+key+"------<value>:"+resb1.getString(key));
	            map.put(key, new String(resb1.getString(key).getBytes("ISO-8859-1"), "UTF-8"));
	        }
		}catch(Exception e){
			logger.error("加载配置异常",e);
		}
	}
	
	public static String getValue(String key){
		return map.get(key);
	}
}
